import json

def main(arg1: str) -> dict:
    """
    只解析JSON的前三层，使用非递归方式
    """
    text = arg1.strip()
    
    # 去掉外层引号
    if text.startswith('"') and text.endswith('"'):
        text = text[1:-1]
    
    # 简单反转义
    text = text.replace('\\"', '"').replace('\\\\', '\\')
    text = text.replace('\\/', '/').replace('\\n', '\n')
    text = text.replace('\\r', '\r').replace('\\t', '\t')
    
    try:
        # 完全解析JSON
        full_data = json.loads(text)
        
        # 手动限制深度（非递归方式）
        result = {}
        
        # 第一层
        for key1, value1 in full_data.items():
            if not isinstance(value1, (dict, list)):
                result[key1] = value1
            elif isinstance(value1, dict):
                # 第二层 - 字典
                level2 = {}
                for key2, value2 in value1.items():
                    if not isinstance(value2, (dict, list)):
                        level2[key2] = value2
                    elif isinstance(value2, dict):
                        # 第三层 - 字典
                        level3 = {}
                        for key3, value3 in value2.items():
                            if not isinstance(value3, (dict, list)):
                                level3[key3] = value3
                            else:
                                # 第四层及以下转为字符串
                                level3[key3] = json.dumps(value3, ensure_ascii=False)
                        level2[key2] = level3
                    elif isinstance(value2, list):
                        # 第三层 - 列表
                        level3 = []
                        for item3 in value2:
                            if not isinstance(item3, (dict, list)):
                                level3.append(item3)
                            else:
                                # 第四层及以下转为字符串
                                level3.append(json.dumps(item3, ensure_ascii=False))
                        level2[key2] = level3
                result[key1] = level2
            elif isinstance(value1, list):
                # 第二层 - 列表
                level2 = []
                for item2 in value1:
                    if not isinstance(item2, (dict, list)):
                        level2.append(item2)
                    elif isinstance(item2, dict):
                        # 第三层 - 字典
                        level3 = {}
                        for key3, value3 in item2.items():
                            if not isinstance(value3, (dict, list)):
                                level3[key3] = value3
                            else:
                                # 第四层及以下转为字符串
                                level3[key3] = json.dumps(value3, ensure_ascii=False)
                        level2.append(level3)
                    elif isinstance(item2, list):
                        # 第三层 - 列表
                        level3 = []
                        for item3 in item2:
                            if not isinstance(item3, (dict, list)):
                                level3.append(item3)
                            else:
                                # 第四层及以下转为字符串
                                level3.append(json.dumps(item3, ensure_ascii=False))
                        level2.append(level3)
                result[key1] = level2
        
        return {"result": result}
        
    except Exception as e:
        return {"result": text}